
public class StringToInt {

	public static void main(String[] args) {

		int result = 0;
		String str = "1234";
		result = string2Integer(str);
		System.out.println(result);
	}
	
	private static int string2Integer(String intStr) {
		int result = 0;
		for (int i = 0; i < intStr.length(); i++) {
			String s = String.valueOf(intStr.charAt(i));
			result += Double.parseDouble(s) * Math.pow(10, intStr.length() - 1 - i);
		}
		return result;
	}

}
